﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _31引用类型传递案例
{
    class Program
    {
        static void Main(string[] args)
        {
            string str1 = new string(new char[] { 'L','C' });
            string str2 = new string(new char[] { 'L','C' });
            Console.WriteLine(str1 == str2);
            Console.WriteLine(str1.Equals(str2));

            object o1 = str1;
            object o2 = str2;
            Console.WriteLine(o1 == o2);
            Console.WriteLine(o1.Equals(o2));

            //可以使用这个方式判断两个引用类型的实例是否为同一个对象
            Console.WriteLine(ReferenceEquals(o1, o2));

            Console.ReadLine();
        }
    }
}
